package com.zzyl.controller.customer;

import com.zzyl.base.PageResponse;
import com.zzyl.base.ResponseResult;
import com.zzyl.service.NursingProjectService;
import com.zzyl.vo.NursingProjectVo;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import static com.zzyl.base.ResponseResult.success;

@RestController
@RequestMapping("/customer/orders/project")
public class CustomerOrdersController {

    @Autowired
    private NursingProjectService nursingProjectService;

    @GetMapping("/page")
    @ApiOperation("分页查询")
    public ResponseResult<PageResponse<NursingProjectVo>> list(String name, Integer status, @RequestParam(value = "pageNum") Integer pageNumber, Integer pageSize) {
        PageResponse<NursingProjectVo> pageResponse = nursingProjectService.selectByPage(name, status, pageNumber, pageSize);
        return success(pageResponse);
    }

    @GetMapping("/{id}")
    @ApiOperation("根据id查询护理项目")
    public ResponseResult<NursingProjectVo> getById(@PathVariable("id") Long id) {
        NursingProjectVo nursingProjectVO = nursingProjectService.findById(id);
        return success(nursingProjectVO);
    }

}
